<extend name="Public/base"/>

<block name="body">
    <div class="am-cf am-u-md-12 header-title">
        <h2>{:isset($info['id'])?'编辑':'新增'}后台菜单</h2>
    </div>
    <div class="am-cf am-u-md-12">
        <form action="{:U()}" method="post" class="am-form am-form-horizontal">
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">标题</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text am-input-lg am-form-field" name="title" value="{$info.title|default=''}">
                    <span class="am-form-help">（用于后台显示的配置标题）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">小图标</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text input-small am-form-field" name="icon" value="{$info.icon|default=''}">
                    <span class="am-form-help">（用于显示在菜单左侧，不填则不显示）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">排序</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text input-small am-form-field" name="sort" value="{$info.sort|default=0}">
                    <span class="am-form-help">（用于分组显示的顺序）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">链接</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text am-input-lg am-form-field" name="url" value="{$info.url|default=''}">
                    <span class="am-form-help">（U函数解析的URL或者外链）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">上级菜单</label>
                <div class="am-u-sm-10">
                    <select name="pid" class="form-select-size am-form-field">
                        <volist name="Menus" id="menu">
                            <option value="{$menu.id}">{$menu.title_show}</option>
                        </volist>
                    </select>
                    <span class="am-form-help">（所属的上级菜单）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">分组</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text am-form-field input-large" name="group" value="{$info.group|default=''}">
                    <span class="am-form-help">（用于左侧分组二级菜单）</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">是否隐藏<span class="am-form-help"></span></label>
                <div class="am-u-sm-10">
                    <label class="radio-inline"><input type="radio" name="hide" value="1">是</label>
                    <label class="radio-inline"><input type="radio" name="hide" value="0">否</label>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">仅开发者模式可见<span class="am-form-help"></span></label>
                <div class="am-u-sm-10">
                    <label class="radio-inline"><input type="radio" name="is_dev" value="1">是</label>
                    <label class="radio-inline"><input type="radio" name="is_dev" value="0">否</label>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">说明</label>
                <div class="am-u-sm-10">
                    <input type="text" class="text input-large am-form-field form-input-width" name="tip" value="{$info.tip|default=''}">
                    <span class="am-form-help">（菜单详细说明）</span>
                </div>
            </div>

            <div class="am-form-group">
                <div class="am-u-sm-10 am-u-sm-offset-2">
                    <input type="hidden" name="id" value="{$info.id|default=''}">
                    <button class="am-btn am-btn-primary submit-btn ajax-post" type="submit" target-form="am-form-horizontal">确 定</button>
                    <button class="am-btn am-btn-default btn-return" onclick="javascript:history.back(-1);return false;">返 回</button>
                </div>
            </div>
        </form>
    </div>
</block>

<block name="script">
    <script type="text/javascript">
        Think.setValue("pid", {$info.pid|default=0});
        Think.setValue("hide", {$info.hide|default=0});
        Think.setValue("is_dev", {$info.is_dev|default=0});
        //导航高亮
        highlight_subnav('{:U('index')}');
    </script>
</block>